//
//  HaoBaNewWebVC.m
//  HaoBaShengxinEn
//
//  Created by 暗流澎涌 on 2024/6/19.
//

#import "HaoBaNewWebVC.h"
#import <WebKit/WebKit.h>
@interface HaoBaNewWebVC ()<WKScriptMessageHandler>
@property (nonatomic,strong)WKWebView *HaobawebView;
@end

@implementation HaoBaNewWebVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creatWeb];
   
}
-(void)creatWeb{
    WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
    [config.userContentController addScriptMessageHandler:self name:@"webClose"];
    self.HaobawebView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) configuration:config];
    [self.HaobawebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.HBUrl]]];
    [self.view addSubview:self.HaobawebView];
}
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message{
    [self.navigationController popViewControllerAnimated:YES];
}
@end
